package com.candy.candysocket.mq;

import com.candy.candysocket.config.NoticeWebsocket;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

/**
 * @author suYanLong
 * @version 1.0
 * @date 2023/8/22 16:44
 * @Description 消费者
 */
@Service
@Slf4j
// @RocketMQMessageListener用法
// https://blog.csdn.net/weixin_44606481/article/details/129897292
// https://blog.csdn.net/weixin_44606481/article/details/129804267
@RocketMQMessageListener(topic = TopicUtils.myGroup, consumerGroup = "my-group", messageModel = MessageModel.BROADCASTING)
// , selectorType = SelectorType.TAG, selectorExpression = "tags")
public class ConsumerExampleBoot implements RocketMQListener<String> {

    @Override
    public void onMessage(String message) {
        log.info(message);
        NoticeWebsocket.sendMessage(message);
    }

}
